package org.ala.tiktools.client_server.bean;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 *
 *	@author ala
 *	@date 2025年4月22日
 */
public class OrderDO implements Serializable {
	private static final long serialVersionUID = 1L;
	
	protected long id;
	protected long buyerId, sellerId;
	protected BigDecimal amount;
	protected List<OrderItemDO> items;
	
	public static OrderDO build() { return new OrderDO(); }
	
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public OrderDO id(long id) {
		setId(id);
		return this;
	}
	public long getBuyerId() {
		return buyerId;
	}
	public void setBuyerId(long buyerId) {
		this.buyerId = buyerId;
	}
	public OrderDO buyerId(long buyerId) {
		setBuyerId(buyerId);
		return this;
	}
	public long getSellerId() {
		return sellerId;
	}
	public void setSellerId(long sellerId) {
		this.sellerId = sellerId;
	}
	public OrderDO sellerId(long sellerId) {
		setSellerId(sellerId);
		return this;
	}
	public BigDecimal getAmount() {
		return amount;
	}
	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}
	public OrderDO amount(BigDecimal amount) {
		setAmount(amount);
		return this;
	}
	public OrderDO amount(double amount) {
		return amount(BigDecimal.valueOf(amount));
	}
	public List<OrderItemDO> getItems() {
		return items;
	}
	public void setItems(List<OrderItemDO> items) {
		this.items = items;
	}
	public OrderDO items(List<OrderItemDO> items) {
		setItems(items);
		return this;
	}
	public OrderDO items(OrderItemDO item) {
		if (items == null) { items = new ArrayList<>(); }
		items.add(item);
		return this;
	}
}
